package com.eaoa.uc.customer.action;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.eaoa.base.EABaseAction;
import com.eaoa.constants.AttachmentConstants;
import com.eaoa.query.pub.PubCustomerQuery;
import com.eaoa.utils.AttachmentUtils;
import com.eaoa.vo.pub.PubCustomer;
import com.stony.core.util.CoreUtils;

public class CustomerManageSearchExpandAction extends EABaseAction{

	protected ActionForward doWork(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		
		Long customerno = CoreUtils.parseLong(request.getParameter("customerno"));
		
		PubCustomer customer = PubCustomerQuery.loadByNo(customerno);
		
		request.setAttribute("result", customer);
		
		if(customerno!=null){
			Map attachments = AttachmentUtils.getAttachmentMap(AttachmentConstants.ATTACHMENTTYPE_CUSTOMER,customerno);
			request.setAttribute("attachments", attachments);
		}
		
		return mapping.findForward("success");
	}
}
